<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="../taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../css/four.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../css/jqe/themes/default/easyui.css"/>
	<link rel="stylesheet" type="text/css" href="../css/jqe/themes/icon.css"/>

    <script type="text/javascript" src="../js/jquery-3.1.1.min.js"></script>
	<script type="text/javascript" src="../js/jquery.easyui.min.js"></script>

    <script type="text/javascript">
    $(function(){
    	//初始化对话框
    	 $('#dw,#dwEdit').window({
    		   onBeforeClose:function(){ 
    			   //取消时关闭等待框
    			   setTimeout(function(){ 
    				   sending.style.visibility = "hidden";
				   }, 250);
    	   }});
    	
   
          $(".btnAll").each(function(i,v){
    	   //变手型
    	     $(v).mouseover(function() {
				$(this).css("cursor", "hand");
			 }).mouseout(function() {
				$(this).css("cursor", "pointer");
			 });
    	   
    	   
    	   if($(v).html()=='【新增】'){
    		   $(v).click(function(){
    			   $('#dw').window("open");
    		   });
    	   }else if($(v).html()=='【编辑】'){
      		   $(v).click(function(){
      			   //ajax
      			   $.get("ajOneCourse.do?kcid="+ $(v).prop("lang")+"&x="+Math.random(),function(jsonTxt){
      				   var jsonObj = eval("("+jsonTxt+")");
      				   $("#upd_kcid").val(jsonObj.kcid);
      				   $("#upd_kcname").val(jsonObj.kcname); 
      				   $("#upd_kcdesc").html(jsonObj.kcdesc); 
      				   $('#dwEdit').window("open");
      			   });
      			   
      			 
      			   
   
      			   
      		   });
    	   }else if($(v).html()=='【删除】'){
    		   $(v).click(function(){
    			  if(confirm("确认删除'"+$(v).prop("title")+"'?")){
    				  location.href="delCourse.do?kcid="+$(v).prop("lang"); 
    			  }
    		   });
    	   } 
       });
       
    });
    </script>
</head>
<body>
	<!-- 包含等待框 -->
	<jsp:include page="../waittable.jsp" flush="true" />
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr valign="top">
			<td bgcolor="#FFFFFF"><table width="96%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#aec3de">
					<tr align="left" bgcolor="#F2FDFF">
						<td colspan="5" class="optiontitle">课程设计表</td>
					</tr>
					<tr align="center">
						<td align="center" bgcolor="#ebf0f7">课程ID</td>
						<td align="center" bgcolor="#ebf0f7">课程名称</td>
						<td align="center" bgcolor="#ebf0f7">课程创建时间</td>
						<td align="center" bgcolor="#ebf0f7">课程描述</td>
						<td align="center" bgcolor="#ebf0f7">操作 <span class="btnAll">【新增】</span> </td>
					</tr>
					<c:forEach items="${page.results}" var="cou">
						<tr align="center" bgcolor="#FFFFFF">
						    <td align="center" bgcolor="#ebf0f7">${cou.kcid}</td>
							<td align="center">${cou.kcname}</td>
							<td align="center"><fmt:formatDate value="${cou.kcdate}" pattern="yyyy-MM-dd"/></td>
							<td align="center">${cou.kcdesc}</td>
							<td align="center">
							【<a href="oneCourse.do?kcid=${cou.kcid}">查看</a>】
									| <span class="btnAll" lang="${cou.kcid}">【编辑】</span>
								    | <span class="btnAll" lang="${cou.kcid}" title="${cou.kcname}">【删除】</span>
				               
							</td>
						</tr>
					</c:forEach>
					<tr align="right" bgcolor="#ebf0f7">
							<td colspan="7">
							<jk:page totalPage="${page.totalPage}" pageNo="${page.pageNo}" totalRecord="${page.totalRecord}"
                                url="listCou.do" />
							</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
		  <td align="center" style="color: red">${msg}</td>
		</tr>
	</table>
  
	<div id="dw" class="easyui-window" title="课程设计表" data-options="modal:true,minimizable:false,closed:true,maximizable:false,iconCls:'icon-save'" style="width:300px;height:230px;padding:10px;display: none;">
		<form action="addCourse.do" method="post">
		     课程名称：<input name="kcname"/><br><br>
		     课程描述 ：<textarea name="kcdesc" rows="3" cols="30"></textarea><br><br>
		      <input type="submit" value="保存"/><br>
		</form>
	</div>
	
	 <div id="dwEdit" class="easyui-window" title="修改课程模块" data-options="modal:true,minimizable:false,closed:true,maximizable:false,iconCls:'icon-save'" style="width:300px;height:230px;padding:10px;display: none;">
		<form action="upCourse.do" method="post">
		<input name="kcid" id="upd_kcid" type="hidden"/>
		     课程名称：<input name="kcname" id="upd_kcname"/><br><br>
		     课程描述 ：<textarea name="kcdesc" rows="3" cols="30" id="upd_kcdesc"></textarea><br><br>
		      <input type="submit" value="修改"/><br>
		</form>
	</div>
	
</body>
</html>